package net.lab1024.sa.admin.module.business.erp.poo.controller;

import net.lab1024.sa.admin.module.business.erp.poo.domain.form.SubordabackAddForm;
import net.lab1024.sa.admin.module.business.erp.poo.domain.form.SubordabackQueryForm;
import net.lab1024.sa.admin.module.business.erp.poo.domain.form.SubordabackUpdateForm;
import net.lab1024.sa.admin.module.business.erp.poo.domain.vo.SubordabackVO;
import net.lab1024.sa.admin.module.business.erp.poo.service.SubordabackService;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import cn.dev33.satoken.annotation.SaCheckPermission;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 暂收送检单行 Controller
 *
 * @Author AKITA
 * @Date 2025-08-03 23:56:39
 * @Copyright AKITA
 */

@RestController
@Tag(name = "暂收送检单行")
public class SubordabackController {

    @Resource
    private SubordabackService subordabackService;

    @Operation(summary = "分页查询 @author AKITA")
    @PostMapping("/subordaback/queryPage")
    @SaCheckPermission("subordaback:query")
    public ResponseDTO<PageResult<SubordabackVO>> queryPage(@RequestBody @Valid SubordabackQueryForm queryForm) {
        return ResponseDTO.ok(subordabackService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author AKITA")
    @PostMapping("/subordaback/add")
    @SaCheckPermission("subordaback:add")
    public ResponseDTO<String> add(@RequestBody @Valid SubordabackAddForm addForm) {
        return subordabackService.add(addForm);
    }

    @Operation(summary = "更新 @author AKITA")
    @PostMapping("/subordaback/update")
    @SaCheckPermission("subordaback:update")
    public ResponseDTO<String> update(@RequestBody @Valid SubordabackUpdateForm updateForm) {
        return subordabackService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author AKITA")
    @PostMapping("/subordaback/batchDelete")
    @SaCheckPermission("subordaback:delete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return subordabackService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author AKITA")
    @GetMapping("/subordaback/delete/{id}")
    @SaCheckPermission("subordaback:delete")
    public ResponseDTO<String> batchDelete(@PathVariable Long id) {
        return subordabackService.delete(id);
    }
}
